package com.party.core.model.wechat;

import com.google.common.collect.Maps;

import java.util.HashMap;
import java.util.Map;

/**
 * 素材类型
 * Created by cyl on 2017/9/8.
 */
public enum  WechatMaterialType {

    NEWS(Integer.valueOf(0), "news"),
    IMAGE(Integer.valueOf(1),"image"),
    VOICE(Integer.valueOf(2),"voice"),
    VIDEO(Integer.valueOf(3),"video"),
    THUMB(Integer.valueOf(4),"thumb");

    private Integer code;
    private String value;

    private WechatMaterialType(Integer code,String value){
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code){
        WechatMaterialType[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            WechatMaterialType WechatMaterialType = var1[var3];
            if(code.equals(WechatMaterialType.getCode())) {
                return WechatMaterialType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer,String> convertMap(){
        HashMap map = Maps.newHashMap();
        WechatMaterialType[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            WechatMaterialType WechatMaterialType = var1[var3];
            map.put(WechatMaterialType.getCode(), WechatMaterialType.getValue());
        }

        return map;
    }
}
